package com.buanalintas.sandals.pos.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "pos_transaction_distribution_detail")
@XmlRootElement
//@NamedQueries({
//    @NamedQuery(name = "PosTransactionDistributionDetail.findAll", query = "SELECT p FROM PosTransactionDistributionDetail p"),
//    @NamedQuery(name = "PosTransactionDistributionDetail.findBySync", query = "SELECT p FROM PosTransactionDistributionDetail p WHERE p.sync = :sync"),
//    @NamedQuery(name = "PosTransactionDistributionDetail.findByDistributionDetailId", query = "SELECT p FROM PosTransactionDistributionDetail p WHERE p.distributionDetailId = :distributionDetailId"),
//    @NamedQuery(name = "PosTransactionDistributionDetail.findByDistributionDetailQuantity", query = "SELECT p FROM PosTransactionDistributionDetail p WHERE p.distributionDetailQuantity = :distributionDetailQuantity")})
public class PosTransactionDistributionDetail implements Serializable {

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "distribution_detail_id")
    private Integer distributionDetailId;
    @Column(name = "distribution_detail_quantity")
    private Integer distributionDetailQuantity;
//    @Basic(optional = false)
//    @Column(name = "distribution_detail_price")
//    private BigDecimal distributionDetailPrice;
    @Lob
    @Column(name = "distribution_detail_description")
    private String distributionDetailDescription;
    @Column(name = "distribution_detail_size")
    private String distributionDetailSize;
    @JoinColumn(name = "distribution_detail_distribution_id", referencedColumnName = "distribution_id")
    @ManyToOne(optional = false)
    private PosTransactionDistribution distributionDetailDistributionId;
    @JoinColumn(name = "distribution_detail_item_id", referencedColumnName = "item_id")
    @ManyToOne(optional = false)
    private PosMasterItem distributionDetailItemId;
    @JoinColumn(name = "distribution_detail_size_id", referencedColumnName = "size_id")
    @ManyToOne(optional = false)
    private PosMasterSize distributionDetailSizeId;

    public PosTransactionDistributionDetail() {
    }

    public PosTransactionDistributionDetail(Integer distributionDetailId) {
        this.distributionDetailId = distributionDetailId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getDistributionDetailId() {
        return distributionDetailId;
    }

    public void setDistributionDetailId(Integer distributionDetailId) {
        this.distributionDetailId = distributionDetailId;
    }

    public PosTransactionDistribution getDistributionDetailDistributionId() {
        return distributionDetailDistributionId;
    }

    public void setDistributionDetailDistributionId(PosTransactionDistribution distributionDetailDistributionId) {
        this.distributionDetailDistributionId = distributionDetailDistributionId;
    }

    public PosMasterItem getDistributionDetailItemId() {
        return distributionDetailItemId;
    }

    public void setDistributionDetailItemId(PosMasterItem distributionDetailItemId) {
        this.distributionDetailItemId = distributionDetailItemId;
    }

    public Integer getDistributionDetailQuantity() {
        return distributionDetailQuantity;
    }

    public void setDistributionDetailQuantity(Integer distributionDetailQuantity) {
        this.distributionDetailQuantity = distributionDetailQuantity;
    }

    public String getDistributionDetailDescription() {
        return distributionDetailDescription;
    }

    public void setDistributionDetailDescription(String distributionDetailDescription) {
        this.distributionDetailDescription = distributionDetailDescription;
    }

    public String getDistributionDetailSize() {
        return distributionDetailSize;
    }

    public void setDistributionDetailSize(String distributionDetailSize) {
        this.distributionDetailSize = distributionDetailSize;
    }

    public PosMasterSize getDistributionDetailSizeId() {
        return distributionDetailSizeId;
    }

    public void setDistributionDetailSizeId(PosMasterSize distributionDetailSizeId) {
        this.distributionDetailSizeId = distributionDetailSizeId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (distributionDetailId != null ? distributionDetailId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosTransactionDistributionDetail)) {
            return false;
        }
        PosTransactionDistributionDetail other = (PosTransactionDistributionDetail) object;
        if ((this.distributionDetailId == null && other.distributionDetailId != null) || (this.distributionDetailId != null && !this.distributionDetailId.equals(other.distributionDetailId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.buanalintas.sandals.pos.entities.PosTransactionDistributionDetail[ distributionDetailId=" + distributionDetailId + " ]";
    }
}
